﻿
@{
    ViewBag.Title = "Login";
    Layout = "~/Views/shard/_layout.cshtml";
}
<div class="headertwo clearfloat" id="header">
    <a href="javascript:history.go(-1)" class="fl box-s"><i class="iconfont icon-arrow-l fl"></i></a>
    <p class="fl">登录</p>
</div>

<div class="sign clearfloat" id="main">
    <ul>
        <li class="clearfloat">
            <i class="iconfont icon-phone fl"></i>
            <input type="text" id="phone" value="" placeholder="请输入手机号" class="fl phone" />
        </li>
        <li class="clearfloat">
            <i class="iconfont icon-lock fl"></i>
            <input type="text" id="pass" value="" placeholder="请输入密码" class="fl phone" />
        </li>
    </ul>
    <a id="btnLogin" href="#" class="pay-btn clearfloat">
        登录
    </a>
    <div class="bottom clearfloat">
        <p class="fl">
            还不是会员？
            <a href="register.html">立即注册</a>
        </p>
        <a href="modify.html" class="fr">忘记密码？</a>
    </div>
</div>
@section footerjs{
    <script type="text/javascript">
        $(function () {
            $('#btnLogin').click(function () {
                var name = $('#phone').val();
                var pass = $('#pass').val();
                $.ajax({
                    url: '/User/Login',
                    data: { name: name, pass: pass },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.status != 'ok') {
                            alert(res.errorMsg);
                        } else {
                            window.location.href = "/Main/Index";
                        }
                    },
                    error: function () {
                        alert("网络错误");
                    }
                })
            })
        })
    </script>
}

